import Vue from 'vue'
import vuex from 'vuex'
Vue.use(vuex);

export default new vuex.Store({
    state: {
        code: '', //获取openid的code
        userInfo: {
            // avatar: "http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTIIaMV5WcAialCHiaqKgJjagakhQBt1jzYP5iaWVicuTAR5llPib6xZLiarlx4vIJvFriaCtqTxERI4NiaVNg/132",
            // id: 1,
            // is_check: 1,
            // mobile: "18750240850",
            // name: "What！",
            // openid: "ocxvUtwspuXAbJu3OjzD1F7oeQiY",
            // acronym_password: 't',
            // full_name: "林**",
            // roleList: [
            //     {
            //         rid: 2,
            //         title: "业主",
            //     },
            //     {
            //         rid: 16,
            //         title: "业主委主任",
            //     },
            //     {
            //         rid: 3,
            //         title: "家属",
            //     },
            //     {
            //         rid: 21,
            //         title: "临时投票",
            //     }
            // ]
        },
        roleType: {}, //角色类型
        residentialType: {}, //选中的小区
        residentialList: [], // 小区列表

        wxInfo: {},//头像 微信名 avatar,name,openid
        landinfo: [], //产权注册信息
        idinfo: [], //身份注册信息
        // bandinfo: [], //实名验证信息
        voteListType: 1, // 表决tab值 
        publicityType: 1, //公示tab值
        suggestType: "tab1", //提议tab值
        shareSuggest: false, //是否分享用户
    },
    getters: {
        getCode: (state, getters) => {
            return state.code
        },
        getUserInfo: (state, getters) => {
            return state.userInfo
        },
        getWxInfo: (state, getters) => {
            return state.wxInfo
        },
    },
    mutations: {
        saveCode(state,res){
            state.code = res;
        },
        // 保存未登录的注册时的信息
        saveUserInfo(state,res){
            state.userInfo = res;
        },
        // 保存未登录的注册时的信息
        saveWxInfo(state,res){
            state.wxInfo = res;
        },
        // 保存产权注册信息
        savePropertyInfo(state,res){
            state.landinfo = res;
        },
        // 保存身份注册信息
        saveIdentityInfo(state,res){
            state.idinfo = res;
        },
        // 保存选择角色
        saveRoleType(state,res){
            state.roleType = res;
        },
        // 保存选择小区
        saveResidentialType(state,res){
            state.residentialType = res;
        },
        saveResidentialList(state,res){
            state.residentialList = res;
        },
        saveVoteListType(state,res){
            state.voteListType = res;
        },
        savePublicityType(state,res){
            state.publicityType = res;
        },
        saveShareSuggest(state,res){
            state.shareSuggest = res;
        },
        saveSuggestType(state,res){
            state.suggestType = res;
        },
        // // 保存实名验证信息
        // saveVerifyInfo(state,res){
        //     state.bandinfo = res;
        // }
    },
    actions: {

    }
})